﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

// NotReviewedButNeeded
#pragma once
#include "GcmpUiViewInterface.h"
#include "WeakReferenceable.h"

namespace gcmp
{
    class IDocument;
    class IUiView;
    class IUiDocumentEvent;

    /// \brief Ui文档
    class GCMP_UI_VIEW_INTERFACE_EXPORT IUiDocument : public WeakReferenceable
    {
        DEFINE_CAST_BASE(gcmp::IUiDocument)

    public:
        /// \brief 析构函数
        virtual ~IUiDocument();

        /// \brief 获取Ui文档的id
        ///
        /// \return Ui文档的id
        virtual int GetId() const = 0;

        /// \brief 获取该Ui文档的所有Ui视图
        ///
        /// \return 该文档的所有Ui视图的指针
        virtual std::vector<const IUiView*> GetAllUiViews() const = 0;
        virtual std::vector<IUiView*> GetAllUiViews() = 0;


        /// \brief 获取Db文档
        ///
        /// \return Db文档的指针     
        virtual const IDocument* GetDbDocument() const = 0;
        virtual IDocument* GetDbDocument() = 0;

        /// \brief 更新所有视图(可能有多个视图同时显示）
        ///
        /// \param isRebuild 是否清除场景重建
        virtual void UpdateView(bool isRebuild = false) = 0;

        /// \brief 更新Ui视图
        ///
        /// 可见性条件发生变化时调用（包括监控Elements增，删和改增量刷新视图，性能比UpdateView(false)差点） 
        virtual void UpdateViewByVisibilityConditionChanged() = 0;    
    };

}//namespace gcmp


